.\" $Id$
.\"

.TH SQLOG-DB-UTIL 8 "SQLOG Database Utility"

.SH NAME
sqlog-db-util \- Utility for SLURM job log database maintenance

.SH SYNOPSIS
.B sqlog-db-util
[\fIOPTIONS\fR]...

.SH DESCRIPTION
The \fBsqlog-db-util\fR utility is an interface for creating and
backfilling the SLURM job log database used by the \fBsqlog\fR(1)
command. It reads the sqlog.conf and slurm-joblog.conf files to
determine the DB users, passwords, and SQL host it should use
for DB creation. 

.SH OPTIONS
.TP 
.BI "-h, --help"
Display a usage message.
.TP
.BI "-i, --info"
Provide information about the currently configured DB, including the
server hostname, read-only username, read-write username, SLURM job
log database name, and the total number of jobs currently stored in
the DB.
.TP
.BI "-v, --verbose"
Increase verbosity.
.TP
.BI "-d, --drop=V"
Drop tables for version V={1,2} of database schema.
Currently, this option doesn't remove SLURM job log users or DB.
.TP
.BI "-c, --create"
Create the SLURM job log DB, the slurm_job_log table, and the associated
read-only and read-write users.
.TP
.BI "-b, --backfill"
Backfill the database with SLURM job information using the list of files
provided on the command line. Files should be in the format created by
SLURM's jobcomp/filetxt plugin. If the files end in .gz, they will be
automatically unzipped at runtime.  Also see --cores-per-node.
.TP
.BI "-x, --convert"
Convert data from database schema version 1 to version 2.  Also see 
--cores-per-node.
.TP
.BI "-B, --backup=RANGE"
Copy data from tables to a file (readable by --backfill).
Specify records via a range of job start times.  RANGE can be any
of: "all", DATE, or DATE..DATE; where DATE is 'yyyy-mm-dd hh:mm:ss',
to specify all jobs, all jobs with a start time older than DATE,
or all jobs with a start time between DATE..DATE, respectively.
Also see --cores-per-node and --obfuscate.
.TP
.BI "-o, --obfuscate"
Obfuscate usernames, userids, and jobnames during a backup operation.
This is useful when sharing joblogs with outside collaborators.
.TP
.BI "-p, --prune=DATE"
Prune database of all jobs with start times older than DATE; write such records to a file.
DATE must be in format of 'yyyy-mm-dd hh:mm:ss'.  Also see --cores-per-node.
.TP
.BI "-C, --cores-per-node=N"
The version 1 schema did not record the number of cores allocated to a job.
For systems that allocate whole nodes to jobs and have the same number of
cores per node, the number of cores allocated to a job can be computed
by multiplying the number of node allocated to a job by the number of
cores per node.  On such systems, use the --cores-per-node option to specify the
number of cores per node.  This option can be used during --convert,
--backfill, and --backup operations.
.TP
.BI "--notrack"
Disable per-job node tracking for jobs inserted during convert
or backfill operations.  If node-tracking is enabled on a system,
i.e., TRACKNODES is not set or is set to 1 in sqlog.conf,
then such jobs will not show up in queries involving specific node names.
.TP
.BI "--delay-index"
Temporarily disable node tracking indicies for jobs inserted during
convert of backfill operations.  This drops the indicies, inserts the jobs,
and rebuilds the indicies.  When converting or inserting lots of records,
this speeds up the operation, however, it makes things slower when loading
only a few records.
.TP
.BI "--recalc-nodecnt"
Some versions of SLURM incorrectly set NODECNT in the jobcomp/script plugin
and thus the nodecount may be incorrect in the sqlog database. Use of this
option along with a \fB--backfill\fR will fix the incorrect nodecount
values by recalculating directly from the nodelist in the joblog.
.BI "-L, --localhost"
Override the SQL host configuration and connect to DB on localhost.
(May be required if root user is only allowed access to DB via localhost)

.SH EXAMPLES
Create database:
.nf

   sqlog-db-util --create

.fi
Insert job records in database for all jobs in current SLURM txt joblog files:
.nf

   sqlog-db-util --backfill /var/log/slurm/joblog*

.fi
Drop an existing version 2 database, recreate using current configuration,
 and seed the new database using SLURM joblog files:
.nf 

   sqlog-db-util -d 2 -cb /var/log/slurm/joblog*

.fi

.SH AUTHOR
Written by Adam Moody and Mark Grondona.

.SH SEE ALSO
\fBsqlog\fR(1), /etc/slurm/sqlog.conf, /etc/slurm/slurm-joblog.conf
